var goto = function (type) {
    var $targets = $('.container > .container-part');
    var top = $targets.eq(type).offset().top;
    $("html,body").animate({'scrollTop':top - 80},1000,function(){});
};

$(function(){

    //debugger
    var type = moto.urlArgs.type;

    /*锚点跳转*/
    // goto(type);
    var $targets = $('.container > .container-part');
    var $bars = $('.h-menu a');
    var isClick = false;

    if(type){
        goto(type);
    }

    $bars.click(function(){
        isClick = true;
        if(isClick === true){
            var top = $targets.eq($(this).index()).offset().top;
            $("html,body").animate({'scrollTop':top - 80},1000,function(){
                isClick = false;
            });
        }

    });




    /*产品介绍tab切换*/
    $('.product-tab .product-tab-li').hover(function() {
        var i = $(this).index();
        $(this).addClass('cur').siblings().removeClass('cur');
        $('.product-con .product-part').eq(i).show().siblings().hide();
    });


    /*吸顶*/
    var TIMER;//定义全局变量
    $(window).scroll( function() {
        clearTimeout(TIMER);//必须要有这句
        if( $(document).scrollTop() > 0 ){
            TIMER = setTimeout(function(){
                $(".header").addClass("header-fix");
            },100);
        }else{
            TIMER = setTimeout(function(){
                $(".header").removeClass("header-fix");
            },500);
        }
    });


    /*$('.flexslider-banner').flexslider({
        animationLoop:false,
        directionNav:false
    });*/


    /*加入我们*/
    var $ul = $('.join-us-ul'),
        $lis = $('.join-us-li'),
        $prev = $('.join-controls-l'),
        $next = $('.join-controls-r'),
        width = $lis.width();
    $prev.click(function(){
        $ul.css('transform','translate(0,0)');
        $prev.addClass('none').siblings().removeClass('none')
    })
    $next.click(function(){

        $ul.css('transform','translate('+(-width * 2 )+'px,0px)');
        $next.addClass('none').siblings().removeClass('none')

    });


    /*职位介绍弹窗*/
    $('.join-us-li').click(function() {
        var i = $(this).index();
        $('.join-li-content li>div').eq(i).show(500).siblings().hide();
    });
    //点击隐藏
    $('.position-intro .close-btn').click(function(){
        $(this).parent().hide(500);
    });
});
/*function disableMute(){
    //3分钟视频播放控制
    $('.full-mask,.video-box').show(500);
    if (document.getElementById("video1") == null){
        $("#video_div").html("<video autoplay loop=\"\"  class=\"video1\" id=\"video1\" controls>\n" +
            "                        <source src=\"http://auv.res.costoon.com/COSTOON_3M20170726.mp4\" type=\"video/mp4\">\n" +
            "                        Your browser does not support the video tag.\n" +
            "                    </video>");
    }
}
function ableMute(){
    //3分钟视频播放暂停
    document.getElementById("video1").pause();
    $('.full-mask,.video-box').hide(500);
}*/
function jsCopy(txtUser) {
    var e = document.getElementById(txtUser);
    e.select();
    document.execCommand("copy"); //执行浏览器复制命令
    $(".copy-hint").show();
   /* alert("该地址已经复制，你可以使用Ctrl+V 粘贴");*/
}

